package com.tyrone.captcha.entity.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.tyrone.captcha.entity.constant.SlideImageCodeConstant;
import lombok.Data;


import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.awt.*;
import java.util.ArrayList;

/**
 * 滑动验证码注册
 *
 * @author xieyl
 * @create 2021/10/27 18:16
 */
@Data
public class SlideImageCodeCheckDto {
    /**
     * 验证码Id
     */
    @NotNull(message = "id 不能为空")
    private String id;
    /**
     * 偏移量
     */
    @NotNull(message = "offset(偏移量) 不能为空")
    @Max(value = SlideImageCodeConstant.OFFSET_THRESHOLD_HIGH,message = "偏移量存在异常(过大)")
    @Min(value = SlideImageCodeConstant.OFFSET_THRESHOLD_LOW,message = "偏移量存在异常(过小)")
    private Integer offset;
    /**
     * 轨迹数组
     */
    @NotNull(message = "trajectory(轨迹数组)不能为空")
    private ArrayList<Point> trajectory;

    /**
     *  MouseDown 和 MouseUp 之间的时间差
     */

    @NotNull(message = "duration(时间间隔) 不能为空")
    @Max(value = SlideImageCodeConstant.TIME_THRESHOLD_HIGH,message = "duration(时间间隔) 过长")
    @Min(value = SlideImageCodeConstant.TIME_THRESHOLD_LOW,message = "duration(时间间隔) 过短")
    private Long duration;
}
